package com.e.dianshang.service.impl;

import com.e.dianshang.mapper.UserMapper;
import com.e.dianshang.pojo.User;
import com.e.dianshang.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.Timestamp;

/**
 * @Description: TOOD
 * @ClassName: UserServicceImpl
 * @Author: ${陈柯宇}
 * Date: 2020/11/11 14:50
 * @Version: 1.0
 */
@Service("userService")
public class UserServiceImpl implements UserService {

    @Resource
    UserMapper userMapper;

    @Override
    public String findByPhone(String phone) {
        return userMapper.findByPhone(phone);
    }

    @Override
    public Integer register(User user) {
        Timestamp createDate = new Timestamp(System.currentTimeMillis());
        user.setCreateDate(createDate);
        return userMapper.insertSelective(user);
    }

    @Override
    public String findPwdByPhone(String phone) {
        return userMapper.findPwdByPhone(phone);
    }

    @Override
    public String findNameByPhone(String phone) {
        return userMapper.findNameByPhone(phone);
    }

    @Override
    public Integer updatePwd(String phone,String pwd) {
        return userMapper.updatePwd(phone,pwd);
    }

}
